package com.lagou.mr.sortnumber;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class SortNumberMapper extends Mapper<LongWritable, Text, LongWritable, NullWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        // 1、直接将数字作为 LongWritable 进行输出
        LongWritable v = new LongWritable();
        v.set(Long.parseLong(value.toString()));
        context.write(v, NullWritable.get());
    }
}
